//
//  BZStatusViewModel.swift
//  weibo
//
//  Created by zzx on 2017/7/30.
//  Copyright © 2017年 zzx. All rights reserved.
//

import UIKit

class BZStatusViewModel: NSObject {

    //引用模型
    var status: BZStatus?{
        didSet{
            
            handleMbrankImage(mbrank: status?.user?.mbrank ?? 0)
            
            handleVerifiedTypeImage(verifiedType: status?.user?.verified_type ?? -1)
            
        }
        
    }
    
    var mbrankImage: UIImage?
    
    ///认证类型等级
    var verifiedTypeImage: UIImage?
    
    //处理会员等级图片
    private func handleMbrankImage(mbrank: Int){
        
        if mbrank >= 1 && mbrank <= 6 {
            
            mbrankImage = UIImage(named: "common_icon_membership_level\(mbrank)")
            
        }else{
            
            mbrankImage = nil
            
        }
        
    }
    
    //认证类型等级图片
    private func handleVerifiedTypeImage(verifiedType: Int) {
        switch verifiedType {
        case 0:
            verifiedTypeImage = UIImage(named: "avatar_vip")
        case 2, 3, 5:
            verifiedTypeImage = UIImage(named: "avatar_enterprise_vip")
        case 220:
            verifiedTypeImage = UIImage(named: "avatar_grassroot")
        default:
            verifiedTypeImage = nil
        }
    }
    
    
    
    
    
}
